//
//  VisitorView.swift
//  sxwb
//
//  Created by TianDu on 2016/11/11.
//  Copyright © 2016年 TianDu. All rights reserved.
//

import UIKit

class VisitorView: UIView {

    @IBOutlet weak var rotationView: UIImageView!
    
    @IBOutlet weak var iconImageView: UIImageView!
    
    @IBOutlet weak var alertLabel: UILabel!
    
    @IBOutlet weak var registerBtn: UIButton!

    @IBOutlet weak var loginBtn: UIButton!
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

    
    /// 通过xib创建visitorView
    ///
    class func createView () -> VisitorView {
        
        return Bundle.main.loadNibNamed("VisitorView", owner: nil, options: nil)?.first as! VisitorView
    }
    
    func setVisitorViewInfo(_ name:String,tips:String) {
        iconImageView.image = UIImage(named: name)
        alertLabel.text = tips
        rotationView.isHidden = true
    }
    
    func addRotationAnimate() {
        
        let rotation = CABasicAnimation(keyPath: "transform.rotation.z")
        rotation.fromValue = 0
        rotation.toValue = M_PI * 2
        rotation.repeatCount = MAXFLOAT
        rotation.duration = 10
        rotation.isRemovedOnCompletion = false
        
        rotationView.layer.add(rotation,forKey: nil)
    }
}
